package com.sunjq.multithread.createconsumer;

public class Creator extends AbstractCreatorAndConsumer implements Runnable {

	public void create() {
		synchronized (wh) {
//			while (true) {
				if (wh.getStatus().equals("consumed")) {
					System.out.println("before create => " + wh.getIncomeId());
					wh.inCome();
					wh.setStatus("created");
					wh.notify();
					System.out.println("create notify wh");
					System.out.println("create this => " + wh.getIncomeId());

				} else {
					try {
						System.out.println("create wait wh");
						wh.wait();
					} catch (InterruptedException e) {
						e.printStackTrace();
					}
				}

			}
//		}

	}

	public void run() {
		this.create();

	}

}
